﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

/// <summary>
/// 所有控件基类
/// </summary>
public class UCBase : Shove.Web.UI.ShoveWebPartUserControl
{
	public UCBase()
	{
	}

    public Site _Site;
    public Customer _Customer;

    public bool isRequestLogin = false;                         // 是否需要登录

    protected override void OnLoad(EventArgs e)
    {
        #region 根据URL，获取站点对象

        _Site = new Site()["www.bq518.com"];

        if (_Site == null)
        {
            PublicFunction.GoError(ErrorNumber.Unknow, "域名无效，限制访问", Shove._Web.Utility.GetUrlWithoutHttp());

            return;
        }

        #endregion

        #region 根据站点ID，获取用户对象

        _Customer = Customer.GetSessionCustomer(_Site.ID);

        #endregion

        //跳回登录页面
        if (isRequestLogin && _Customer == null)
        {
            Response.Redirect("Default.aspx?PN=Login");
        }


        base.OnLoad(e);
    }


}
